﻿setwd("D:/ppp/ShareScripts")   #Set YOUR working directory as this example.
list<-read.table("TPC_list.dat", header=TRUE) #get the file list from an list file.

i<-1
k<-1
while(i<(length(list[[1]])+1))
{
		j<-1
		name<-as.character(list[i,1])
		date<-as.character(list[i,2])
		lname<-as.character(list[i,3])
		dir<-"I:/D/TaurusBUR/Stat"
		dir<-paste(dir,name,sep="/")
		dir<-paste(dir,date,sep="")
		dir<-paste(dir,"NH2-out_1.txt",sep="/")
    gas<-read.table(dir,header=FALSE)
    #ra<-gas[[1]]   
    #dec<-gas[[2]]    #Delete the comment symble if you need the coordinates.  
    pNH2<-gas[[3]]/1e21   #We use 1e21 cm^{-2} as the unit of column densities.
    
    while(j<length(gas[[1]])+1) {
    allNH2[k+j,1]<-pNH2[j]
    j<-j+1
    }
    k<-k+j
    i<-i+1
    }
